package com.example.demo.controller;

import com.example.demo.model.Blog;
import com.example.demo.model.User;
import com.example.demo.service.BlogService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class PersonController {
    @Resource
    private BlogService blogService;

    @RequestMapping("/person")
    public List<Blog> personList(@SessionAttribute(value = "user",required = false)User user){
        return blogService.getAllBlogById(user.getUserId());
    }
}
